import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:word_range_client/widgets/welcome/LoginButton.dart';
import 'package:word_range_client/widgets/welcome/LogonButton.dart';
// 元素
import 'package:word_range_client/widgets/welcome/WelcomeTitle.dart';

class GeneralWelcome extends StatelessWidget {
  const GeneralWelcome({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Theme.of(context).colorScheme.onPrimary,
      body: const SafeArea(
        child: _WelcomeBody(),
      ),
    );
  }
}

class _WelcomeBody extends StatefulWidget {
  const _WelcomeBody({super.key});

  @override
  State<_WelcomeBody> createState() => _WelcomeBodyState();
}

class _WelcomeBodyState extends State<_WelcomeBody> {

  @override
  void initState(){
    super.initState();
    SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(statusBarColor: Colors.transparent));
  }

  @override
  void dispose() {
    super.dispose();
    SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: const BoxDecoration(
          image: DecorationImage(
              image: AssetImage("assets/images/The_Starry_Night_1_1.png"),
              fit: BoxFit.cover
          )
      ),
      padding: const EdgeInsets.all(30),
      child: const Column(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          WelcomeTitle(),
          Column(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              LoginButton(),
              SizedBox(height: 20,),
              LogonButton()
            ],
          )
        ],
      ),
    );
  }
}


// class WelcomeBody extends StatelessWidget {
//   const WelcomeBody({super.key});
//
//   @override
//   Widget build(BuildContext context) {
//     return
//   }
// }
